
<div class="sponshorship">

<?php 


if (!isset($_SESSION["login"]))
{

	//header("Location: ".createCleanUrl("pageName","login","backurl",encryptUrl(createUrl())));
?>
    <a href="<?php echo createCleanUrl("pageName","login","backurl",encryptUrl(createUrl())); ?>"><?php echo $var_shop_login; ?></a>
    <?php
}else{
$clientId=getClientIdByMail($_SESSION["login"]);

$max=5;

if (getParameter($portletUID."submit"))
{
	
	
	$i=0;
	$sendername=getUserFullname();
	$sendercompany=getUserCompany();
	
	while($i++<$max){
		
	$mail=getParameter($portletUID."email_".$i);	
	$company=getParameter($portletUID."company_".$i);
	if ($mail && $company)
	{
	//echo "send mail for ".$mail;
	


	$key=TEAencrypt($_SESSION["login"],KEY);
	$host=$_SERVER['HTTP_HOST'];
	if (isLocal())  $host=getPortalUrl().".betasite.net";
	$link="http://".$host."/?pageName=createaccount&sponsor=".$key;

    $data=array();
        $data["company"]=$company;
        $data["sendername"]=$sendername;
        $data["sendercompany"]=$sendercompany;
        $data["portal"]=getPortalName();
        $data["discount"]=$var_shop_discount;
        $data["link"]=$link;
	sendMailTo($mail, TemplateWithData($var_shop_mail_sponsorship,$data));
	sendMailToAdmins($portalId,TemplateWithData($var_shop_mail_sponsorship,$data) );
	
	
	}
	}
	ShowSuccess($var_shop_sponsorship_request_notification);
	
}
	
?>
<form action="<?php echo createUrl(); ?>" method="POST">
<?php $i=0;

while($i++<$max){
	
	?>

<div class="line"> <div class="company">    <?php echo $var_shop_company; ?> : <?php formText($portletUID."company_".$i,0,"input"); ?></div> <div class="mail"> <?php echo $var_shop_mail; ?> : <?php formText($portletUID."email_".$i,0,"account_input"); ?></div> </div>
	<?php 
	
}
?>
<br/>
<input type="submit" value="<?php echo $app_portal_send; ?>" name="<?php echo $portletUID; ?>submit" class="button"/>
</form>
    <?php } ?>
</div>
